<table>
	<tr>
		<td>Damage</td>
		<td><input type="text" id="damage" /></td>
		<td>Penetration</td>
		<td><input type="text" id="pen" /></td>
	</tr>
	<tr>
		<td>Armor/MagRes.</td>
		<td><input type="text" id="armor" /></td>
	</tr>
</table>

<div id="result" >

</div>


<input type="button" value="Calculate" onclick="calculate()" />
<script>
	function calculate(){
		damage = document.getElementById("damage").value;
		pen = document.getElementById("pen").value;
		armor = document.getElementById("armor").value;
		var armorFinal = 100;
		var armorTmp = armor - pen;
		if(armorTmp > 0){
			armorFinal += armorTmp;
		}
		result = (damage * 100) / armorFinal;
		
		document.getElementById("result").innerHTML = Math.round(result);
	}
</script>